<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'assess.label', default: 'Assess')}" />
    <title>评估历史</title>
</head>
<body>
<div class="small-header transition animated fadeIn">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>评估历史</span>
                    </li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
                评估历史
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">
<div class="row">
    <g:form method="POST" action="searchHistory">
        <div class="hpanel hgreen">

            <div class="panel-heading">
                 <div class="panel-tools">
                    <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                    <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                        <i class="fa fa-times"></i>重置</button>
                </div>
                查询
            </div>

            <div class="panel-body form-horizontal">
                <div class="row flex">
                    <div class="form-group col-sm-4">
                        <label class="col-sm-3 control-label">房产地址</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" placeholder="请输入房产地址" name="address" id="address" value="${params?.address}">
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label class="col-sm-3 control-label" for="loansDuration">高评倾向</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="isFrequency" id="isFrequency" from="${['正常', '高评倾向']}" noSelection="${['': '请选择高评倾向']}" value="${params?.isFrequency}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label class="col-sm-3 control-label">评估类型</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="assessType" id="assessType" optionKey="name" optionValue="name" from="${com.cindata.dictionary.AssessTypeDict.list()}" noSelection="${['': '请选择评估类型']}" value="${params?.assessType}"/>
                        </div>
                    </div>
                </div>
                <div class="row flex">
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">评估状态</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="assessStatus" id="assessStatus" optionKey="name" optionValue="name" from="${com.cindata.dictionary.AssessStatusDict.list()}" noSelection="${['': '请选择评估状态']}" value="${params?.assessStatus}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">用户姓名</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="fullName" id="fullName" from="${com.cindata.User.list()}" optionKey="fullName" optionValue="fullName" noSelection="${['': '请选择用户姓名']}" value="${params?.fullName}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">评估时间</label>
                        <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker" style="width: 75%;">
                            <input type="text" class=" form-control " placeholder="请选择评估时间上限"
                                   value="${params?.startDateStart}" name="startDateStart" id="startDateStart" style="text-align: left" />
                            <span class="input-group-addon">至</span>
                            <input type="text" class=" form-control " placeholder="请选择评估时间下限"
                                   value="${params?.startDateEnd}" name="startDateEnd" id="startDateEnd" style="text-align: left" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </g:form>


    <div class="hpanel hgreen">
        <div class="panel-heading">
            评估历史
        </div>

        <div class="panel-body no-padding">
            <div class="table-responsive">
                <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                    <thead>
                    <tr>
                        <g:sortableColumn property="name" title="房产地址"/>
                        <g:sortableColumn property="name" title="高评倾向"/>
                        <g:sortableColumn property="createdDate" title="评估状态"/>
                        <g:sortableColumn property="modifiedDate" title="评估类型"/>
                        <g:sortableColumn property="modifiedDate" title="评估单价（元）"/>
                        <g:sortableColumn property="modifiedDate" title="评估总价（元）"/>
                        <g:sortableColumn property="modifiedDate" title="成交总价（元）"/>
                        <g:sortableColumn property="modifiedDate" title="外部评估总价（元）"/>
                        <g:sortableColumn property="modifiedDate" title="用户姓名"/>
                        <g:sortableColumn property="modifiedDate" title="操作时间"/>
                    </tr>
                    </thead>
                    <tbody>
                    <g:each in="${assessList}">
                        <tr>
                            <td><g:link action="show" id="${it.id}" class="firstTd" style="color: #3498DB">${it?.address}</g:link></td>
                            <td><g:if test="${it?.isFrequency}">高评倾向</g:if><g:if test="${!it?.isFrequency}">正常</g:if></td>
                            <td>${it?.assessStatus?.name}</td>
                            <td>${it?.assessType?.name}</td>
                            <td>
                            <g:if test = "${it?.assessUnitPrice == 0}">
                                --
                            </g:if>
                            <g:else>
                                <g:formatNumber number="${it?.assessUnitPrice}"  maxIntegerDigits="20" minFractionDigits="1" />
                            </g:else>
                            </td>
                            <td>
                                <g:if test = "${it?.assessTotalPrice == 0}">
                                    --
                                </g:if>
                                <g:else>
                                    <g:formatNumber number="${it?.assessTotalPrice}"  maxIntegerDigits="20" minFractionDigits="1" />
                                </g:else></td>
                            <td>
                                <g:if test = "${it?.finalPrice == 0}">
                                    --
                                </g:if>
                                <g:else>
                                    <g:formatNumber number="${it?.finalPrice}"  maxIntegerDigits="20" minFractionDigits="1" />
                                </g:else></td>
                            <td>
                                <g:if test = "${it?.externalAssessPrice == 0}">
                                    --
                                </g:if>
                                <g:else>
                                    <g:formatNumber number="${it?.externalAssessPrice}"  maxIntegerDigits="20" minFractionDigits="1" />
                                </g:else></td>
                            <td>${it?.user?.fullName}</td>
                            <td><g:formatDate date="${it?.createdDate}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate></td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
        </div>
        
        <div class="panel-footer">
            <div class="pagination">
                <g:paginate total="${assessCount ?: 0}" params="${params}"/>
            </div>
        </div>
    </div>
</div>

<g:javascript>
    $(function () {

        $("#resetBtn").click(function () {
            $("#address").val("");
            $("#isFrequency").val("");
            $("#s2id_isFrequency span:first").html("请选择高评倾向");
            $("#assessType").val("");
            $("#s2id_assessType span:first").html("请选择评估类型");
            $("#assessStatus").val("");
            $("#s2id_assessStatus span:first").html("请选择评估状态");
            $("#fullName").val("");
            $("#s2id_fullName span:first").html("请选择用户姓名");
            $("#startDateStart").val("");
            $("#startDateEnd").val("");
        })

        $('#datepicker').datepicker({
            language: 'zh-CN'
        });
        $("#datepicker").on("changeDate", function(event) {
            $("#my_hidden_input").val(
                    $("#datepicker").datepicker('getFormattedDate')
            )
        });

    });
</g:javascript>
</body>
</html>